﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            label1.Text = "";
            try
            {
                string html = webBrowser1.DocumentText;
                string re = @"(1)\d{10}|[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+";
                MatchCollection mc = Regex.Matches(html, re);
                foreach (Match match in mc) label1.Text += match.ToString()+'\n';
            }
            catch(Exception exception)
            {
                label1.Text = "出错！";
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.Refresh();
            string url = textBox1.Text;
            try
            {
                webBrowser1.Url = new Uri(url);
                webBrowser1.Navigate(url);
            }
            catch(Exception exception)
            {
                webBrowser1.DocumentText = "出错！";
            }
        }
    }
}
